package com.marion.mrpc.client;

import com.marion.mrpc.Peer;
import com.marion.mrpc.transport.TransportClient;

import java.util.List;

/**
 * 表示哪个server去连接
 */
public interface TransportSelector {

    /**
     * 初始化select
     * @param peerList 可以连接的断点信息
     * @param count client与server建立多少连接
     * @param clazz clients实现class
     */
    void init(List<Peer> peerList, int count, Class<? extends TransportClient> clazz);

    /**
     * 选择一个transport与server连接
     * @return TransportClient
     */
    TransportClient select();

    void release(TransportClient client);

    void close();

}
